<?php
namespace app\admin\controller\example;
use app\admin\controller\Backend;

use JohnLui\AliyunOSS;

class Oss extends Backend
{

	protected $config = [];
	protected $networkType = '经典网络';

	
	public function _initialize() {
		parent::_initialize();
		$this->config = config('service.oss');
		$this->ossClient = AliyunOSS::boot(
			$this->config['city'],
			$this->config['networkType'],
			$this->config['isInternal'],
			$this->config['accessKeyId'],
			$this->config['accessKeySecret']
		);
	}

	public function uploadfile() {
		// $r = $this->ossClient
		// 	->setBucket($this->config['bucketName'])
		// 	->uploadFile(125, '/Users/xuewl/htdocs/public_html/wechat_fast.master/public/uploads/20170908/live/0d78d2a4abcc1a32979da615b3dcc582.jpg');
		// echo "<img src='http://gy-yxc.oss-cn-beijing.aliyuncs.com/125'>";
		return $this->fetch();
	}
}